﻿using System.Collections.Generic;
using System.Linq;
using System;

namespace ReAnimation.Helpers.Common
{
    public static class EnumerableHelper
    {
        public delegate void ForEachBody<T>(T obj);
        public static void ForEach<T>(this IEnumerable<T> enumeration,ForEachBody<T> body)
        {
            foreach (var v in enumeration)
            {
                body(v);
            }
        }

        public static IEnumerable<T> Clone<T>(this IEnumerable<T> enumeration) where T: class,ICloneable
        {
            return enumeration.Select<T,T>((x) => {return x.Clone() as T;});
        }
    }
}
